﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Tunnel.DevicesControls
{
    public partial class FCMSPlayListAdd : Form
    {
        FCMSForm fcmsForm;
        public FCMSPlayListAdd(FCMSForm fcmsForm)
        {
            InitializeComponent();
            this.fcmsForm = fcmsForm;
        }

        private void buttonOK_Click(object sender, EventArgs e)
        {
            Global g = new Global();
            SqlDBHelper sdh = new SqlDBHelper();
            string sqlInsertPlayList = "INSERT INTO M_PlayList (PlayListID,Name,usingFCMS) VALUES ('" + g.CommandID + "','" + textBox1.Text + "','')";
            if (textBox1.Text == string.Empty)
            {
                MessageBox.Show("请输入播放列表名称！");
            }
            else
            {
                DialogResult dr = MessageBox.Show("确定增加这个播放列表吗？", "请确认", MessageBoxButtons.YesNo);
                if (dr == DialogResult.Yes)
                {
                    sdh.ExecuteCommand(sqlInsertPlayList);
                    fcmsForm.getPlayList();
                    this.Close();
                }
            }
        }
    }
}
